<template>
  <view class="demo-container">
    <!-- 基础用法 -->
    <view class="demo-block">
      <view class="demo-block__title">基础用法</view>
      <view class="demo-block__content">
        <fu-number-scroll :value="value1" />
      </view>
    </view>
    
    <!-- 自定义动画时长 -->
    <view class="demo-block">
      <view class="demo-block__title">自定义动画时长</view>
      <view class="demo-block__content">
        <fu-number-scroll 
          :value="value2" 
          :duration="2"
        />
      </view>
    </view>
    
    <!-- 数字间延迟 -->
    <view class="demo-block">
      <view class="demo-block__title">数字间延迟</view>
      <view class="demo-block__content">
        <fu-number-scroll 
          :value="value3" 
          :delay="0.2"
        />
      </view>
    </view>
    
    <!-- 动态变化 -->
    <view class="demo-block">
      <view class="demo-block__title">动态变化</view>
      <view class="demo-block__content">
        <fu-number-scroll :value="value4" />
        <view class="button-group">
          <fu-button 
            type="primary"
            size="small"
            @click="increase"
          >增加</fu-button>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      value1: 0,
      value2: 456,
      value3: 789,
      value4: 100
    }
  },
  mounted() {
    // 延迟显示动画效果
    setTimeout(() => {
      this.value1 = 123
    }, 500)
  },
  methods: {
    increase() {
      this.value4 += Math.floor(Math.random() * 100)
    }
  }
}
</script>

<style lang="scss" scoped>
.demo-container {
  padding: 20rpx;
}

.demo-block {
  margin-bottom: 30rpx;
  
  &__title {
    margin-bottom: 20rpx;
    font-size: var(--fu-font-size-lg);
    color: var(--fu-text-color);
  }
  
  &__content {
    background-color: #fff;
    border-radius: var(--fu-radius-base);
    padding: 30rpx;
  }
}

.button-group {
  margin-top: 20rpx;
}
</style> 